﻿CREATE proc thuan_qtdanhmucchuongtrinhsua      
@ID int,      
@TenChuongTrinh nvarchar(255),    
@DienGiai nvarchar(255)  ,    
@NhomCT int  ,  
@Hinh as image =null ,  
@DuongDan as nvarchar(1000)   
as      
if exists(select * from DanhMuc_ChuongTrinh Where MaChuongTrinh<>@ID and TenChuongTrinh=@TenChuongTrinh)      
begin      
select ErrCode=0      
end      
else      
begin      
  
  
  
          
             
if(@DuongDan ='' or @DuongDan is null)            
begin            
update DanhMuc_ChuongTrinh set TenChuongTrinh=@TenChuongTrinh,DienGiai=@DienGiai,NhomCT=@NhomCT WHere MaChuongTrinh=@ID          
end            
            
else            
begin            
update DanhMuc_ChuongTrinh set TenChuongTrinh=@TenChuongTrinh,DienGiai=@DienGiai,NhomCT=@NhomCT,Hinh=@Hinh WHere MaChuongTrinh=@ID               
end          
  
select ErrCode=1      
  
end